import setting
import numpy as np
from os import system
from time import sleep
from qiskit import QuantumCircuit, Aer, execute
from qiskit.visualization import plot_histogram

def cout(text):
    print(text)

def icin(number):
    try:
        a = int(input(number))
        return a
    except:
        print('not a number')
        raise ValueError

def scin(text):
    try:
        a = str(input(text))
        return a
    except:
        print('not a text')
        raise ValueError

def cmd(textline):
    try:
        system(textline)
    except:
        print('I can\'t do that')
        raise SystemError

def stop(time):
    try:
        sleep(time)
    except:
        print('can not stop with a text')
        raise ValueError

def abc(number):
    try:
        answer = number - number * 2
        return answer
    except:
        print('not a number')
        raise ValueError


def JM(text, n_qubits=3):
    # 将明文字符串转换为数字矩阵A
    A = [ord(c) for c in text]

    # 创建量子电路
    qc = QuantumCircuit(n_qubits)

    # 使用量子计算机对数字矩阵A进行一次或多次操作
    for i in range(len(A)):
        if i % 2 == 0:
            qc.h(i)
        else:
            qc.cx(i, (i + 1) % n_qubits)

    # 将操作后的量子态转换回数字矩阵B
    B = qc.density_matrix(range(n_qubits)).toarray()

    # 对数字矩阵B进行一次或多次操作
    for i in range(len(B)):
        if i % 2 == 0:
            qc.h(i)
        else:
            qc.cx(i, (i + 1) % n_qubits)

    # 将最终结果矩阵转换回字符串
    encrypted_text = ''.join([chr(int(round(b))) for b in B])

    return encrypted_text

def biggest(*list):
    try:
        turn = 0
        for temp in list:
            if temp > trun:
                turn = temp
    except:
        print('not a list of number')
        raise ValueError
    return turn

def smallest(*list):
    try:
        turn = 0
        for temp in list:
            if temp < trun:
                turn = temp
    except:
        print('not a list of number')
        raise ValueError
    return turn

cout(biggest(12, 13))
cout(smallest(12, 13))